import request from '../../util/axios'

// 分页查询用户信息
export const getUserList = (data) => request({
  url: '/yuyi-user-boot/api/sys/v1/sysUser/paging',
  method: 'post',
  data
})

// 新增用户信息
export const addUser = (data) => request({
  url: '/yuyi-user-boot/api/sys/v1/sysUser',
  method: 'post',
  data
})

// 分页查询角色已有用户
export const transferUserSelected = (id, data) => request({
  url: `/yuyi-user-boot/api/sys/sysRole/${id}/user/paging`,
  method: 'post',
  data
})
// 角色添加用户
export const transferAddUser = (id, data) => request({
  url: `/yuyi-user-boot/api/sys/sysRole/${id}/user`,
  method: 'post',
  data
})
// 角色移除用户
export const transferRemoveUser = (id, data) => request({
  url: `/yuyi-user-boot/api/sys/sysRole/${id}/user`,
  method: 'delete',
  data
})

// 获取全宗+部门组织结构(两级)
export const getQzOrg = () => request({
  url: '/yuyi-user-boot/api/sys/sysOrg/byFonsNo'
})

// 修改用户信息
export const editUser = (data) => request({
  url: '/yuyi-user-boot/api/sys/v1/sysUser',
  method: 'put',
  data
})

// 查看用户信息
export const seeUser = (data) => request({
  url: `/yuyi-user-boot/api/sys/v1/sysUser/${data}`
})

// 修改用户信息
export const delUser = (data) => request({
  url: '/yuyi-user-boot/api/sys/v1/sysUser',
  method: 'delete',
  data
})

// 重置用户密码
export const resetPsdUser = (data) => request({
  url: '/yuyi-user-boot/api/sys/v1/sysUser/restPass',
  method: 'put',
  data
})

// 分页查询角色信息
export const getRoleList = (data) => request({
  url: '/yuyi-user-boot/api/sys/sysRole/paging',
  method: 'post',
  data
})

// 新增角色信息
export const addRole = (data) => request({
  url: '/yuyi-user-boot/api/sys/sysRole',
  method: 'post',
  data
})

// 修改角色信息
export const editRole = (data) => request({
  url: '/yuyi-user-boot/api/sys/sysRole',
  method: 'put',
  data
})

// 删除角色信息
export const delRole = (data) => request({
  url: '/yuyi-user-boot/api/sys/sysRole',
  method: 'delete',
  data
})

// 查看角色信息
export const seeRole = (data) => request({
  url: `/yuyi-user-boot/api/sys/sysRole/${data}`
})

// 分页查询用户组未有角色
export const transferRole = (id, data) => request({
  url: `/yuyi-user-boot/api/sys/v1/sysUser/${id}/role/notSearch`,
  method: 'post',
  data
})
// 分页查询用户组未有角色
export const transferRoled = (id, data) => request({
  url: `/yuyi-user-boot/api/sys/v1/sysUser/${id}/role/search`,
  method: 'post',
  data
})
// 用户添加角色
export const transferAddRole = (id, data) => request({
  url: `/yuyi-user-boot/api/sys/v1/sysUser/${id}/role`,
  method: 'post',
  data
})
// 用户添加角色
export const transferDelRole = (id, data) => request({
  url: `/yuyi-user-boot/api/sys/v1/sysUser/${id}/role`,
  method: 'delete',
  data
})

// 用户获取已设置菜单权限
export const getMenuSeted = (userId, data) => request({
  url: `/yuyi-user-boot/api/sys/v1/sysUser/${userId}/menu`,
  method: 'post',
  data
})
// 更新用户已设置菜单权限
export const editMenuSeted = (userId, data) => request({
  url: `/yuyi-user-boot/api/sys/v1/sysUser/${userId}/menu`,
  method: 'put',
  data
})

// 保存用户机构权限设置
export const saveUserMechanismJurisdiction = (data) => request({
  url: '/yuyi-user-boot/api/sys/sysOrganizationScope/userData',
  method: 'post',
  data
})
// 保存用户门类数据权限
export const saveUserCategoryJurisdiction = (data) => request({
  url: '/yuyi-user-boot/api/sys/sysCategoryScope/user',
  method: 'post',
  data
})

// 更新角色已设置菜单权限
export const editRoleMenuSeted = (userId, data) => request({
  url: `/yuyi-user-boot/api/sys/sysRole/${userId}/menu`,
  method: 'put',
  data
})

// 保存角色机构权限设置
export const saveRoleMechanismJurisdiction = (data) => request({
  url: '/yuyi-user-boot/api/sys/sysOrganizationScope/roleData',
  method: 'post',
  data
})
// 保存角色门类数据权限
export const saveRoleCategoryJurisdiction = (data) => request({
  url: '/yuyi-user-boot/api/sys/sysCategoryScope/role',
  method: 'post',
  data
})

// 角色获取已设置菜单权限
export const getRoleMenuSeted = (userId, data) => {
  return request({
    url: `/yuyi-user-boot/api/sys/sysRole/${userId}/menu`,
    method: 'post',
    data
  })
}

// 获取表序列节点
export const getTableLabelNode = (tableId, data) => {
  return request({
    url: `/yuyi-category-boot/api/metadata/user/sequence/${tableId}/next`,
    method: 'post',
    data
  })
}
